//
//  BookManager.m
//  03-NSStringNSArrayNSMutableArray
//
//  Created by 402030900@qq.com on 16/7/6.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "BookManager.h"
#import "Book.h"
@implementation BookManager

- (instancetype)init{
    self = [super init];
    if (self) {
        self.BookArray = [NSMutableArray array];
    }
    return self;
}

- (void)addBook:(Book *)book{
    [self.BookArray insertObject:book atIndex:0];
}

- (void)removeBook:(Book *)book{
    [self.BookArray removeObject:book];
}

-(void)modifyPriceName:(NSString *)bookName Price:(NSString *)price{
    for (Book *book in self.BookArray) {
        if ([book.name isEqualToString:bookName]) {
            book.price = price;
            NSLog(@"书名:%@价格更改为:%@",book.name, book.price);
        } else {
            NSLog(@"不存在这本书");
        }
    }
}
- (void)showBook{
    for (Book *book in self.BookArray) {
        NSLog(@"%@", book.name);
    }
}


@end
